<template>
  <div class="asheng-comm-kf-popup">
    <div class="asheng-comm-kf-dlalog">
      <div class="asheng-ckd-content">
        <div class="asheng-ckd-qrcode-img" v-if="c.qrcodeUrl">
          <img :src="c.qrcodeUrl" id="asheng-ckd-qrcode-img" />
        </div>
        <div class="asheng-ckd-shibie">
          扫码联系客服经理
        </div>
        <!-- <div class="asheng-ckd-shibie">办理套餐等问题点击下面在线客服</div>
                <div class="asheng-ckd-btn" @click="linkKf"><a>在线客服</a></div> -->
      </div>
      <div class="asheng-comm-kf-dlalog-close" @click="closeKf">
        <img id="asheng-ckdc-btn" src="/image/v2/close_white.png" />
      </div>
    </div>
  </div>
</template>

<script>
import { customConfigByUsercode } from '@/api/phone/custom'
export default {
  name: 'OnlineKf',
  props: {
    custom: {
      type: Object,
    },
  },
  data() {
    return {
      c: {},
      id: '',
    }
  },
  created() {
    this.initCurrPageData()
  },
  methods: {
    closeKf() {
      this.$emit('closeKf')
    },
    initCurrPageData() {
      this.id = this.$route.query.id
      if (this.custom) {
        this.c = this.custom
      } else {
        //加载配置
        customConfigByUsercode({ id: this.id }).then((res) => {
          if (res.code == 200) {
            this.c = res.data
          }
        })
      }
    },
    linkKf() {
      this.$emit('linkKf')
    },
  },
}
</script>
<style scoped>
/* 弹窗客服开始 */
.asheng-comm-kf-popup {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0px;
  left: 0px;
  z-index: 99;
  background: rgba(0, 0, 0, 0.4);
}

.asheng-comm-kf-dlalog {
  position: absolute;
  width: 80%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.asheng-comm-kf-dlalog-close {
  text-align: center;
  margin-top: 20px;
}

.asheng-ckd-content {
  background-color: white;
  border-radius: 20px;
  padding: 20px;
}

.asheng-ckd-wxno {
  line-height: 30px;
  text-align: center;
  line-height: 30px;
  font-size: 16px;
  font-weight: 700;
  color: #000;
}

.asheng-comm-kf-dlalog-close img {
  width: 35px;
  height: 35px;
}

.asheng-ckd-shibie {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-top: 5px;
  margin-bottom: 10px;
}

.asheng-ckd-btn {
  width: 130px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 10px;
  overflow: hidden;
  margin: 10px auto 0 auto;
}

.asheng-ckd-btn a {
  display: block;
  color: #fff;
  background-color: #1aad17;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.asheng-ckd-qrcode-img {
  text-align: center;
}

.asheng-ckd-qrcode-img img {
  width: 80%;
}

/* 弹窗客服结束 */
</style>

